home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / AppMaker 2.0b3 / Demo AppMaker 1.5 / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpC_101_Globals < prev    next >
Encoding:
Text File  |  1992-04-08  |  1.5 KB  |  84 lines

  1. /* %filename% */
  2. /* Created %date% %time% by AppMaker */
  3.  
  4. #include <Types.h>
  5. #include <Quickdraw.h>
  6. #include <Controls.h>
  7. #include <Dialogs.h>
  8. #include <Events.h>
  9. #include <Lists.h>
  10. #include <Menus.h>
  11. #include <TextEdit.h>
  12. #include "Globals.h"
  13.  
  14. /*Standard vars:*/
  15. Boolean            quittingTime;                             
  16. EventRecord        curEvent;                          
  17. WindowPtr        curWindow;
  18. WinInfoPtr        cur;
  19. Boolean            inBackground;
  20. SysConfigRec    sysConfig;
  21.  
  22. WinInfoRec        noCur;
  23.  
  24. %If lang = MPW%
  25.     #pragma segment Globals 
  26.  
  27. %end if%
  28. /*----------*/
  29. void InitGlobals (void)
  30. {
  31.     curWindow = nil;
  32.     noCur.text = nil;
  33.     noCur.vScroll = nil;
  34.     noCur.hScroll = nil;
  35.     noCur.fileNum = 0;
  36.     noCur.volNum = 0;
  37.     noCur.dirty = false;
  38.     noCur.windowKind = noWindow;
  39.  
  40.     cur = &noCur;
  41. } /*InitGlobals*/
  42.  
  43. /*----------*/
  44. void SetInfo (WindowPtr        window)
  45. {
  46.     WinInfoPtr        infoPtr;
  47.  
  48.     if (window != curWindow) {
  49.         curWindow = window;
  50.         if (curWindow != nil) {
  51.             infoPtr = (WinInfoPtr) GetWRefCon (curWindow);
  52.             cur = infoPtr;
  53.         } else {
  54.             cur = &noCur;
  55.         }
  56.     }
  57. } /*SetInfo*/
  58.  
  59. /*----------*/
  60. void SetNewInfo (WindowPtr        window)
  61. {
  62.     WinInfoPtr        infoPtr;
  63.  
  64.     infoPtr = (WinInfoPtr) NewPtr (sizeof (WinInfoRec));
  65.     SetWRefCon (window, (long) infoPtr);
  66.     SetInfo (window);
  67. } /*SetNewInfo*/
  68.  
  69. /*----------*/
  70. void DiscardInfo (WindowPtr        window)
  71. {
  72.     WinInfoPtr        infoPtr;
  73.  
  74.     if (window == curWindow) {
  75.         SetInfo (nil);
  76.     }
  77.     infoPtr = (WinInfoPtr) GetWRefCon (window);
  78.     DisposPtr ((Ptr) infoPtr);
  79.     HideWindow (window);
  80.     DisposeWindow (window);
  81. } /*DiscardInfo*/
  82.  
  83. /* Globals */
  84.